<?php

/**
 * Register form.
 *
 * @package    quotes
 * @subpackage form
 * @author     Your name here
 */
class RegisterForm extends sfGuardUserForm
{
  public function configure()
  {
    parent::configure();
    unset($this['user_id'], $this['first_name'], $this['last_name']);

    $this->widgetSchema['birthday']= new sfWidgetFormDateJQueryUI(array("change_month" => true, "change_year" => true));
    $this->validatorSchema['email'] = new sfValidatorEmail();

    //$this->validatorSchema['email'] = new sfValidatorPropelUnique(array('model' => 'sfGuardUserProfile', 'column' => 'email'));

    //$this->validatorSchema->setPostValidator(new sfValidatorPropelUnique(array('model' => 'sfGuardUserProfile', 'column' => 'username')));
    //$this->validatorSchema->setPostValidator(new sfValidatorPropelUnique(array('model' => 'sfGuardUserProfile', 'column' => 'username')));

    $this->widgetSchema->setNameFormat('register[%s]');
  }

  public static function getYears()
  {
    $years = array();
    for ($i=1950; $i < date('Y'); $i++)
    {
      $years[$i] = $i;
    }
    return $years;
  }
}
